vcSimInterface

vcSimInterface is a behavior used for connecting components physically or remotely to one another and exchanging data. This "one to one interface" base class supports connecting only to single other interface at a time, but can have multiple sections.

See in: Overview

Module: vcBehaviors

Parent: vcBehavior

Children: vcOneToManyInterface

Referenced by: vcSimInterfaceSection.Interface

Properties

Learn how to use properties here. The properties are also inherited from the parent class.

NameTypeAccessDescription
AngleToleranceRealRWGets or sets an angle tolerance for allowing interfaces to connect to the interface when not aligned on same axis.
ConnectedComponentvcComponentRGets the component connected to interface.
See more
If no connection, value is None.

Exceptions:
RuntimeError: When the owning component hasn't been initialized.
ConnectedFromSectionsvcList[vcSimInterfaceSection]RGets gets a list of all sections in this interface that have an active connection to another interface.
If no connection, the value is an empty list.
ConnectedToSectionsvcList[vcSimInterfaceSection]RGets a list of sections in other interfaces which are connected to sections of this interface.
If no connection, value is an empty list.
DistanceToleranceRealRWGets or sets the distance at which the interface snaps to an available connection, thereby completing Plug and Play.
IsAbstractBooleanRWGets or sets a value indicating whether this interface supports remote connections.
See more
When False, the interfaces need to be aligned in the 3D world when connected.

Exceptions:
RuntimeError: When this interface is connected.
IsConnectedBooleanRGets a value indicating whether this interface is currently connected to any other interface.
SectionsvcList[vcSimInterfaceSection]RGets a list of all sections in interface.
If no sections, value is an empty list.

Methods

Learn how to use methods here. The methods are also inherited from the parent class.

NameReturn TypeParametersDescription
canConnectBooleanvcSimInterface interfaceReturns True if a given interface can connect to the interface; otherwise, returns False.
See more
Triggers the OnMatch event, which can affect the result.

Parameters:
interface (vcSimInterface): The interface to connect to this interface.

Returns:
bool: True when connection is possible. False otherwise.
cancelConnectionChangeNoneNoneRequests that the current Connect or Disconnect operation to be cancelled.
See more
Only has effect if called from either OnConnecting or OnDisconnecting event handler.
The operation may have been cancelled already by an earlier event handler, or may get cancelled by an another Python or .NET handler after this one.
connectBooleanvcSimInterface interface,
Optional Keyword[retainOffset = Boolean]
Tries to connect a given interface to this interface.
The OnMatch and OnConnecting event handlers can prevent the connection.
See more
Parameters:
interface (vcSimInterface): The interface to connect.
retainOffset (bool): Whether to retain the offset when attaching component to another using Hierarchy field.

Returns:
bool: True when connection succeeded or was cancelled. False otherwise.
createSectionvcSimInterfaceSectionString sectionNameAdds a new section of a given name to interface, and then returns the new section.
See more
Parameters:
sectionName (str): Name to assign to the section. Empty string is replaced with "Unnamed"

Returns:
vcSimInterfaceSection: The created section object.

Exceptions:
RuntimeError: When this interface is connected.
disconnectBooleanOptional Keyword[otherInterface = vcSimInterface]Tries to remove all or specific connections in this interface.
See more
An optional otherInterface argument can be used to disconnect a specific interface from the interface, for example when interface is one-to-many.
OnDisconnecting event handlers can prevent the disconnection.

Parameters:
otherInterface (vcSimInterface): Other interface to disconnect from.

Returns:
bool: True when disconnect succeeded or was cancelled. False otherwise.

Exceptions:
RuntimeError: When node hierarchy of the component is locked.
overrideMatchResultNoneBoolean enableOverride,
Boolean matchResult
Overrides default internal interface matching constraints to either accept or decline a connection match with another interface.
See more
Only has an effect if called from OnMatch event handler.

Parameters:
enableOverride (bool): Whether to enable the override mechanism. False means the default internal logic is used.
matchResult (bool): The desired result. True means the interfaces are considered to match regardless of the default internal matching rules.

Events

Learn how to use events here. The events are also inherited from the parent class.

NameParametersDescription
OnConnectvcSimInterface otherInterface,
bool retainOffset
Triggered when interface is connected to another interface.
See more
Parameters:
otherInterface (vcSimInterface): The interface that was connected.
retainOffset (bool): See retainOffset parameter in the connect method.
OnConnectingvcSimInterface otherInterfaceTriggered when interface is about to be connected to another interface.
See more
The connection can be cancelled by calling the cancelConnectionChange() method from the event handler.

Parameters:
otherInterface (vcSimInterface): The interface about to be connected to this interface.
OnDisconnectvcSimInterface otherInterfaceTriggered when interface is disconnected from another interface.
See more
Parameters:
otherInterface (vcSimInterface): Interface that was disconnected from this interface.
OnDisconnectingvcSimInterface otherInterfaceTriggered when interface is about to be disconnected from another interface.
See more
The disconnection can be cancelled by calling the cancelConnectionChange() method from the event handler.

Parameters:
otherInterface (vcSimInterface): The interface about to be disconnected from this interface.
OnMatchvcSimInterface otherInterfaceTriggered when interfaces are tested as being able to connect to one another.
See more
Occurs during Plug And Play operations, automatic connecting of components, and when connecting interfaces through API.

Parameters:
otherInterface (vcSimInterface): The candidate for connection being tested.

Example: Find Connected Component From Interface Behavior

""" This example shows how to get a handle to the component that is connected via interface behavior. """

import vcCore as vc

comp = vc.getComponent()
interface = comp.findBehavior("PathInterface")
connected_comp = interface.ConnectedComponent
print (connected_comp.Name)